from common.mysql import mysql
from config.read_config import congfig_read
import jsonpath
from common.send_request import request_run_main
from common.allure_report import allure_report
import json

from log.log import test_log
import random
import redis



class ZhiFu():


        def __init__(self,uid,environment,coupon=None,scene=None):                                   #初始化传入客户uid


               self.environment=environment
               self.phone_number=uid
               self.coupon=coupon
               self.scene=scene
               # 配置文件地址
               self.config_path = "config\Transaction.ini"
               #sql配置文件section
               self.sql_path=environment+"/mobile-app"
               # sql语句
               pin = "e64096a6730f75fad73a23903bc9d41e"
               ecif_text = 'select ecif_id from t_user  where uid={}'.format(uid)
               pin_text = "update t_user set pin={} where uid={} ".format(repr(pin), uid)
               uid_text='select uid from t_user  where uid={}'.format(uid)
               # 调用数据库
               self.db=mysql(self.config_path,self.sql_path)
               # 调用update语句设置pin码
               self.db.upadate(pin_text)
               # 调用查询语句获取用户cif
               self.ecif = self.db.select_one(ecif_text)[0]
               self.uid=self.db.select_one(uid_text)[0]



        def login(self):
            #配置文件section
            AppLogin=self.environment+'/AppLogin'
            #redis配置文件section
            Redis=self.environment+"/redis"
            #链接redis
            host = congfig_read(self.config_path).get(Redis, 'host')
            password = congfig_read(self.config_path).get(Redis, 'password')
            port = congfig_read(self.config_path).get(Redis, 'port')
            r=redis.Redis(host=host,port=port,password=password,db=1)
            #获取请求头          
            header = {"uid": str(self.uid), "Content-Type": "application/json", "app-version": "144",
                      "device-type": "android", "languageId": "in", "ecifId": self.ecif,
                      "deviceUuid": "1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370","deviceId":"52968771-4b0c-caa3-d22a-6d127f5a179a",
                      "sm-device-id":"BZYUKTgng9xJOGG4KqB3O6yX/GSCHvDNSiMJrdQDE96Sv9a37Ks1S8agYCyZ0cM56udYf35JeSMZsJCOdKiZ4LQ==","sm-trace-id":"4688af40-35aa-497b-b2c8-8b33a985e36b|1689598336965",
                      "appVersionName":"2.7.60","deviceMode":"Redmi Note 7 Pro","osVersion":"10"}
           
            #获取验证码
            otpcode_url = congfig_read(self.config_path).get(AppLogin, 'otpcode_url')
            otpcode_data={"phoneNumber":self.phone_number,"smsType":"2"}
            otpcode_response = request_run_main(otpcode_url, header, otpcode_data)
            verifyCode=otpcode_response.json()["data"]["verifyCode"]
            print(verifyCode)
            #重置PIN码和登陆密码前的检查
            ResetPredo_url = congfig_read(self.config_path).get(AppLogin, 'ResetPredo_url')
            ResetPredo_data={"phoneNumber":self.phone_number,"otpCode":verifyCode,"smsType":"2"}
            ResetPredo_response = request_run_main(ResetPredo_url, header, ResetPredo_data)
            #获取安全operationId
            Strategy_url = congfig_read(self.config_path).get(AppLogin, 'Strategy_url')
            Strategy_data = {"type":1012,"gps_permission_type":1,
                             "latitude":"22.528976869116438","longitude":"113.94397123258697",
                             "phoneNumber":self.phone_number,"deviceUuid":"1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370",
                             "androidId":"5924dd9bb4386b94","deviceId":"52968771-4b0c-caa3-d22a-6d127f5a179a"}
            Strategy_response = request_run_main(Strategy_url, header, Strategy_data)
            operationId=Strategy_response.json()["data"]["operationId"]
            print(operationId)
            #获取token
            login_url = congfig_read(self.config_path).get(AppLogin, 'login_url')
            login_data={"phoneNumber":self.phone_number,"pin":"a037478ee933b43bb07407c85b953275",
                        "otpCode":verifyCode,"operationId":operationId,
                        "deviceUuid":"1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370",
                        "androidId":"5924dd9bb4386b94","deviceId":"52968771-4b0c-caa3-d22a-6d127f5a179a"}
            login_response = request_run_main(login_url, header, login_data)
            accessToken=login_response.json()["data"]["accessToken"]
            semiAccessToken = login_response.json()["data"]["semiAccessToken"]

            #将token存入缓存
            r.set("accessToken",accessToken)
            r.expire("accessToken",150)
            r.set("semiAccessToken",semiAccessToken)
            r.expire("semiAccessToken",150)







        def Buy_deposit(self,deposit_id,acctAmt):                      #购买定存，deposit_id定存产品id 例如：TF01-1M-PRE     acctAmt ：购买定存产品的金额

            # 获取请求方法，请求类型，url，请求头
            Deposit=self.environment+'/deposit'
            #查询定存信息
            DepositDetail_url=congfig_read(self.config_path).get(Deposit, 'DepositDetail_url')
            # 利息试算接口
            interest_url = congfig_read(self.config_path).get(Deposit, 'interest_url')
            # 订单创建接口
            order_url = congfig_read(self.config_path).get(Deposit, 'order_url')
            # 查询收银台
            query_url = congfig_read(self.config_path).get(Deposit, 'query_url')
            # 订单详情接口
            orderDetails_url = congfig_read(self.config_path).get(Deposit, 'orderDetails_url')
            # 支付下单接口
            payment_url = congfig_read(self.config_path).get(Deposit, 'payment_url')
            header = {"uid": str(self.uid), "Content-Type": "application/json", "app-version": "118",
                      "device-type": "android", "languageId": "in", "ecifId": self.ecif,"deviceUuid":"1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370"}

            #查询定存信息
            data_0 = {"productId": deposit_id}
            response_0 = request_run_main(DepositDetail_url, header, data_0)
            #产品属性是TS01,TS02,TS03
            combiProdId=response_0.json()['data']['combiProdId']
            #购买产品的利率
            rate=response_0.json()['data']['rate']
            #定存产品的期限
            termCode=response_0.json()['data']['termCode']

            #获取利息
            data = {"efftInrt": rate, "openAcctAmt": acctAmt, "combiProdId": combiProdId, "ccyCode": "IDR", "tenorCode":termCode}
            response=request_run_main(interest_url,header,data)
            totalEstimated=response.json()['data']['totalEstimated']

            # 获取下单单号
            data_1 = {"productId": deposit_id, "orderAmount": acctAmt, "payAmount": acctAmt, "estimatedInterest": totalEstimated, "rolloverType": 2, "couponSerialNo": ""}
            response_1=request_run_main(order_url,header,data_1)
            orderNo=response_1.json()['data']['orderNo']
            #获取支付账户
            data_2={"orderNo":orderNo}
            response_2=request_run_main(query_url,header,data_2)
            accountNo=jsonpath.jsonpath(response_2.json(),"$..accountNo")[0]

            #查询订单详情
            response_3 = request_run_main(orderDetails_url, header, data_2)

            #支付订单
            data_3={"settlementAccount":accountNo,"orderNo":orderNo,"pin":"a037478ee933b43bb07407c85b953275"}
            response_4 = request_run_main(payment_url, header, data_3)
            if response_4.json()['success']==True and response_4.json()['data'] != None:
                print("购买定存成功")
            else:
                print("购买失败")

        def PhoneBill(self):
            Phone_MKP_text='update t_router_config set present_router="mkp->last1 in [0,1,2,3,4,5,6,7,8,9]" where out_biz_type=1001 and operator="TELKOMSEL"'
            E_Wallet_text='update t_router_config set present_router="mkp->last1 in [0,1,2,3,4,5,6,7,8,9]" where out_biz_type=1002 and operator="OVO"'
            self.db.upadate(Phone_MKP_text)
            print("数据库更新成功")
            #配置文件section
            Life_services=self.environment+'/Life_services'
            #产品请求信息
            header = {"uid": str(self.uid), "Content-Type": "application/json", "app-version": "144",
                      "device-type": "android", "ecifId": self.ecif,"deviceUuid":"1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370"}
            #请求sku列表url并获取响应
            skuList_url = congfig_read(self.config_path).get(Life_services, 'skuList_url')
            skuList_data={"fulfillmentType":1001,"account":"81284351111"}
            skuList_response=request_run_main(skuList_url,header,skuList_data)
            #获取响应中产品编号
            id=skuList_response.json()['data'][4]["id"]
            #获取响应中原始支付金额
            originalPrice=skuList_response.json()['data'][4]["originalPrice"]
            #获取供应商信息
            operatorName=skuList_response.json()['data'][4]["operatorName"]
            #获取实际支付金额
            favorablePrice=skuList_response.json()['data'][4]["favorablePrice"]
            # 请求券列表接口并获取响应
            CouponList_url = congfig_read(self.config_path).get(Life_services, 'CouponList_url')
            CouponList_data={"couponStatus":"B","scene":10,"couponBusinessType":"L","prodId":"L01","oriAmount":originalPrice}
            CouponList_response = request_run_main(CouponList_url, header, CouponList_data)

            #计算券金额
            CouponCal_url = congfig_read(self.config_path).get(Life_services, 'CouponCal_url')
            #订单创建接口
            OrderCreate_url = congfig_read(self.config_path).get(Life_services, 'OrderCreate_url')
            # 订单详情接口
            OrderDetail_url = congfig_read(self.config_path).get(Life_services, 'OrderDetail_url')
            #账户列表接口
            AccountList_url=congfig_read(self.config_path).get(Life_services, 'AccountList_url')
            #安全接口
            Strategy_url=congfig_read(self.config_path).get(Life_services, 'Strategy_url')
            #支付订单接口
            payment_url=congfig_read(self.config_path).get(Life_services, 'payment_url')
            #订单详情接口
            OrderQuery_url = congfig_read(self.config_path).get(Life_services, 'OrderQuery_url')
            x=1
            while x<3:
                try:
                 if   self.coupon !="None" :

                     # 请求计算券金额接口,获取支付金额
                    #CouponType = CouponList_response.json()["data"]["instantDiscountList"][0]["couponType"]
                    #CouponSerialNo = CouponList_response.json()["data"]["instantDiscountList"][0]["couponSerialNo"]
                    CouponCal_data = {"scene": 10, "couponSerialNo": self.coupon, "oriAmount": originalPrice,
                                      "couponType": "A01", "prodId": "L01"}
                    CouponCal_response = request_run_main(CouponCal_url, header, CouponCal_data)

                    payAmount = CouponCal_response.json()['data']['payAmount']
                    #创建订单获取orderNO
                    OrderCreate_data = {"productType": 4, "outBizType": 1001, "orderAmount": originalPrice,
                                        "payAmount": payAmount, "productId": id, "account": "81284351111",
                                        "couponNo": self.coupon, "couponType": "A01",
                                        "operatorName": operatorName}
                    OrderCreate_response = request_run_main(OrderCreate_url, header, OrderCreate_data)
                    orderNo = OrderCreate_response.json()["data"]["orderNo"]
                    # 请求订单详情接口
                    OrderDetail_data = {"orderNo": orderNo}
                    OrderDetail_response = request_run_main(OrderDetail_url, header,
                                                            OrderDetail_data)
                    # 获取账户列表
                    AccountList_data = {"payAmount": payAmount, "unmask": "true", "ifCache": "false",
                                        "appointAccountType": "", "scene": 0}
                    AccountList_response = request_run_main(AccountList_url, header,
                                                          AccountList_data)
                    accountNo = AccountList_response.json()['data'][0]['accountNo']
                    # 获取operationId
                    Strategy_data = {"type": 1022, "phoneNumber": self.phone_number,
                                     "deviceUuid": "1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370",
                                     "androidId": "5924dd9bb4386b94",
                                     "deviceId": "52968771-4b0c-caa3-d22a-6d127f5a179a",
                                     "gps_permission_type": 1,
                                     "latitude": "22.592786471163937", "longitude": "113.84924527888147",
                                     "amount": originalPrice, "recharge_phone": "81284351111"}
                    Strategy_response = request_run_main(Strategy_url, header, Strategy_data)
                    operationId = Strategy_response.json()['data']['operationId']
                    # 支付订单
                    payment_data = {"settlementAccount": accountNo, "operationId": operationId,
                                    "orderNo": orderNo, "pin": "a037478ee933b43bb07407c85b953275"}
                    payment_response = request_run_main(payment_url, header, payment_data)
                    payNo=payment_response.json()['data']['payNo']
                    if payNo != None:
                            print("使用券支付成功,支付金额{}".format(payAmount))
                            return {"code":10000,"success": True ,"message":"使用券支付成功，支付金额{}".format(payAmount)}
                    else:
                        x=x+1
                        print("支付失败,响应数据为{}".format(payment_response.json()))
                        return {"code": 20000, "success": False, "message": "支付失败"}
                 else:
                     CouponCal_data = {"scene": 10, "couponSerialNo": "", "oriAmount": originalPrice,
                                       "couponType": "", "prodId": "L01"}
                     CouponCal_response = request_run_main(CouponCal_url, header, CouponCal_data)
                     payAmount = CouponCal_response.json()['data']['payAmount']
                     # 请求订单创建接口
                     OrderCreate_data = {"productType": 4, "outBizType": 1001, "orderAmount": originalPrice,
                                         "payAmount": payAmount, "productId": id, "account": "81284351111",
                                         "couponNo": "", "couponType": "", "operatorName": operatorName}
                     OrderCreate_response = request_run_main(OrderCreate_url, header,
                                                             OrderCreate_data)
                     orderNo = OrderCreate_response.json()["data"]["orderNo"]
                     # 请求订单详情接口
                     OrderDetail_data = {"orderNo": orderNo}
                     OrderDetail_response = request_run_main(OrderDetail_url, header,
                                                             OrderDetail_data)
                     # 获取账户列表
                     AccountList_data = {"payAmount": payAmount, "unmask": "true", "ifCache": "false",
                                         "appointAccountType": "", "scene": 0}
                     AccountList_response = request_run_main(AccountList_url, header,
                                                           AccountList_data)
                     accountNo = AccountList_response.json()['data'][0]['accountNo']
                     # 获取operationId
                     Strategy_data = {"type": 1022, "phoneNumber": self.phone_number,
                                      "deviceUuid": "1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370",
                                      "androidId": "5924dd9bb4386b94",
                                      "deviceId": "52968771-4b0c-caa3-d22a-6d127f5a179a",
                                      "gps_permission_type": 1,
                                      "latitude": "22.592786471163937", "longitude": "113.84924527888147",
                                      "amount": originalPrice, "recharge_phone": "81284351111"}
                     Strategy_response = request_run_main(Strategy_url, header, Strategy_data)
                     operationId = Strategy_response.json()['data']['operationId']
                     # 支付订单
                     payment_data = {"settlementAccount": accountNo, "operationId": operationId,
                                     "orderNo": orderNo, "pin": "a037478ee933b43bb07407c85b953275"}
                     payment_response = request_run_main(payment_url, header, payment_data)
                     payNo = payment_response.json()['data']['payNo']
                     if payNo != None:
                         print("未使用券支付成功,支付金额{}".format(payAmount))
                         return {"code":10000,"success": True ,"message":"未使用券支付成功，支付金额{}".format(payAmount)}
                     else:
                         x=x+1
                         print("支付失败,响应数据为{}".format(payment_response.json()))
                         return {"code": 20000, "success": False, "message": "支付失败"}


                except  Exception as e:
                    x=x+1
                    print("支付失败",e)
                    return {"code": 20000, "success": False, "message": "支付失败"}

            # return payAmount




        def Va(self,ammount):  #VA支付

            # 配置文件section
            Va = self.environment+'/Va'
            # 产品请求信息
            header = {"uid": str(self.uid), "Content-Type": "application/json", "app-version": "118",
                          "device-type": "android", "languageId": "in", "ecifId": self.ecif,"deviceUuid":"1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370",
                      }
            MerchantCode_header={"appId":"488163027587473408","sign":"8fad05ee50e6e2d090efc720f467be4f","Content-Type": "application/json","Cookie":"acw_tc=9581d30116276265983425774e09a6d18b8dd40119b7f95e606d9dd0369c22"}
            MerchantCode_url = congfig_read(self.config_path).get(Va, 'MerchantCode_url')
            MerchantCode_data = {
                      "orderNo": "123890wang101477"+str(random.randint(10,10000)),
                      "payType": 1,
                      "totalAmount": ammount,
                      "mchId": "1601111404026007551", "skuId": 5464, "skuName": "iphone16", "vaName": "vaname",
                      "orderStartTime":"2022-03-16 16:21:46", "orderEndTime":"2025-05-02 19:45:00",
                      "url": "https://www.baidu.com"
                    }
            try:
                #获取商家码
                Merchant_Response=request_run_main(MerchantCode_url, MerchantCode_header, MerchantCode_data)
                if Merchant_Response.json()['success']==True and  Merchant_Response.json()['data']["vaCode"] !=None:
                       vaCode=Merchant_Response.json()['data']["vaCode"]

                else:
                    for i in range(4):
                        code_response=request_run_main(MerchantCode_url, header, MerchantCode_data)
                        if code_response.json()['success']==True and  code_response.json()['data']["vaCode"] !=None:
                            vaCode=code_response.json()['data']["vaCode"]
                            print(vaCode)
                            break
                        else:
                            test_log.error("获取商家码获取失败,错误信息:{}".format(code_response.json()['errMsg']))
                            print("获取商家码获取失败,错误信息:{}".format(code_response.json()['errMsg']))
                    return
                # 订单金额查询
                InfoV2_url = congfig_read(self.config_path).get(Va, 'InfoV2_url')
                InfoV2_data={"vaCode":vaCode,"transferAmount":0,"receiverBankCode":"490"}
                InfoV2_response = request_run_main(InfoV2_url, header, InfoV2_data)
                transferAmount=InfoV2_response.json()["data"]['transferAmount']


                #获取券列表
                OptimaLlist_url = congfig_read(self.config_path).get(Va, 'OptimaLlist_url')
                OptimaLlist_data = {"couponStatus":"B","prodId":"P01","scene":0,"couponBusinessType":"P","vaCode":vaCode,"oriAmount":transferAmount}
                OptimaLlist_response = request_run_main(OptimaLlist_url, header, OptimaLlist_data)
                if OptimaLlist_response.json()["data"]["instantDiscountList"]:
                    #获取支付金额
                    CouponCal_url = congfig_read(self.config_path).get(Va, 'CouponCal_url')
                    CouponCal_data={"couponSerialNo":"A10","oriAmount":transferAmount,"couponType":"A10","scene":0,"vaCode":vaCode}
                    CouponCal_response=request_run_main(CouponCal_url, header, CouponCal_data)
                    payAmount=CouponCal_response.json()["data"]["payAmount"]
                    #订单创建接口
                    OrderCreate_url = congfig_read(self.config_path).get(Va, 'OrderCreate_url')
                    OrderCreate_data = {"orderAmount":payAmount,"payAmount":payAmount,"linkUrl":"https://pre-m.bankneo.co.id/pro/hematpay/order-detail",
                                        "vaCode":vaCode,"PayDiscountList":{"couponDisCount":[{"couponSerialNo":"A10","promotionAmount":0,"distributionType":0,"promotionType":"0"}]}}
                    OrderCreate_response = request_run_main(OrderCreate_url, header, OrderCreate_data)
                    payNo=OrderCreate_response.json()["data"]["payNo"]

                    #获取账户列表
                    AccountList_url=congfig_read(self.config_path).get(Va, 'AccountList_url')
                    AccountList_data={"payAmount":"30000","unmask":"true","ifCache":"false","appointAccountType":"","scene":0}
                    AccountList_response= request_run_main(AccountList_url, header, AccountList_data)
                    accountNo=AccountList_response.json()['data'][0]["accountNo"]

                    #走安全获取operitionId
                    Strategy_url = congfig_read(self.config_path).get(Va, 'Strategy_url')
                    Strategy_data = {"type":1042,"phoneNumber":self.phone_number,
                                     "deviceUuid":"1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370",
                                     "androidId":"5924dd9bb4386b94",
                                     "deviceId":"52968771-4b0c-caa3-d22a-6d127f5a179a",
                                     "gps_permission_type":1,
                                     "latitude":"22.528976869116438","longitude":"113.94397123258697","amount":payAmount}
                    Strategy_response = request_run_main(Strategy_url, header, Strategy_data)
                    operationId=Strategy_response.json()["data"]["operationId"]
                    #支付订单
                    Submit_url = congfig_read(self.config_path).get(Va, 'Submit_url')
                    Submit_data={"payNo":payNo,"pin":"a037478ee933b43bb07407c85b953275",
                                 "settlementAccountNo":accountNo,"operationId":operationId}

                    Submit_response = request_run_main(Submit_url, header, Submit_data)
                    if  Submit_response.json()["data"]["payStatus"]==2:
                        OrderQuery_url = congfig_read(self.config_path).get(Va, 'OrderQuery_url')
                        OrderQuery_data={"payNo":payNo}
                        OrderQuery_response=request_run_main(OrderQuery_url, header, OrderQuery_data)
                        RealityAmount=OrderQuery_response.json()["data"]["payAmount"]
                        print("使用券订单支付成功,下单金额{}，实际支付金额{}".format(payAmount,RealityAmount))
                    else:
                        print("订单支付失败")
                else:
                    # 获取支付金额
                    CouponCal_url = congfig_read(self.config_path).get(Va, 'CouponCal_url')
                    CouponCal_data = {"couponSerialNo": "A10", "oriAmount": transferAmount, "couponType": "A10",
                                      "scene": 0, "vaCode": vaCode}
                    CouponCal_response = request_run_main(CouponCal_url, header, CouponCal_data)
                    payAmount = CouponCal_response.json()["data"]["payAmount"]
                    # 订单创建接口
                    OrderCreate_url = congfig_read(self.config_path).get(Va, 'OrderCreate_url')
                    OrderCreate_data = {"orderAmount": payAmount, "payAmount": payAmount,
                                        "linkUrl": "https://pre-m.bankneo.co.id/pro/hematpay/order-detail",
                                        "vaCode": vaCode,}
                    OrderCreate_response = request_run_main(OrderCreate_url, header,
                                                            OrderCreate_data)
                    payNo = OrderCreate_response.json()["data"]["payNo"]

                    # 获取账户列表
                    AccountList_url = congfig_read(self.config_path).get(Va, 'AccountList_url')
                    AccountList_data = {"payAmount": "30000", "unmask": "true", "ifCache": "false",
                                        "appointAccountType": "", "scene": 0}
                    AccountList_response = request_run_main(AccountList_url, header,
                                                            AccountList_data)
                    accountNo = AccountList_response.json()['data'][0]["accountNo"]

                    # 走安全获取operitionId
                    Strategy_url = congfig_read(self.config_path).get(Va, 'Strategy_url')
                    Strategy_data = {"type": 1042, "phoneNumber": self.phone_number,
                                     "deviceUuid": "1686813227581-577669-ff6d4863-21ac-4b1f-a6a5-bc5ec3f75370",
                                     "androidId": "5924dd9bb4386b94",
                                     "deviceId": "52968771-4b0c-caa3-d22a-6d127f5a179a",
                                     "gps_permission_type": 1,
                                     "latitude": "22.528976869116438", "longitude": "113.94397123258697",
                                     "amount": payAmount}
                    Strategy_response = request_run_main(Strategy_url, header, Strategy_data)
                    operationId = Strategy_response.json()["data"]["operationId"]
                    # 支付订单
                    Submit_url = congfig_read(self.config_path).get(Va, 'Submit_url')
                    Submit_data = {"payNo": payNo, "pin": "a037478ee933b43bb07407c85b953275",
                                   "settlementAccountNo": accountNo, "operationId": operationId}

                    Submit_response = request_run_main(Submit_url, header, Submit_data)
                    if Submit_response.json()["data"]["payStatus"] == 2:
                        OrderQuery_url = congfig_read(self.config_path).get(Va, 'OrderQuery_url')
                        OrderQuery_data = {"payNo": payNo}
                        OrderQuery_response = request_run_main(OrderQuery_url, header,
                                                               OrderQuery_data)
                        RealityAmount = OrderQuery_response.json()["data"]["payAmount"]
                        print("未使用券订单支付成功,下单金额{}，实际支付金额{}".format(payAmount, RealityAmount))
                    else:
                        print("订单支付失败")

            except Exception as e:
                test_log.error("错误信息",e)
                print("支付失败",e)












#定存
# phone='830412419377'
# deposit_id="TS01-1M-QU"
# acctAmt=1000000
# a=ZhiFu(phone,"pre")
# a.Buy_deposit(deposit_id,acctAmt)

# #VA充值
# uid='29936243'
# a=ZhiFu(uid)
# a.Va()

#话费重置
#
# uid='13935299'
# a=ZhiFu(uid,"pre")
# a.PhoneBill()



